Simple ``one-liner'' functions can be typed in at the command line.
However, they are destroyed when the session is ended. When
writing longer functions, or functions that you want to save for
repeated usage; it is convenient to create them using a text editor
and save them on disk as an ordinary ASCII text file.
The function load
will execute the rlab statements in a file
as if they were typed at the command line. The rlab command
rfile
searches a specified path for files with a `.r'
extension. When the rfile command finds a file that matches it's
argument, it executes the rlab statements in the file as if they
were typed at the command line.
Statements in a file are executed in the same manner as they would
be had they been typed in interactively, ordinary commands and
multiple functions are O.K. In fact, complete programs can be
written and run interactively or in batch mode. To run a program in
batch mode you can try:
$ rlab program.r &
Or the program could contain #!/usr/local/bin/rlab
on the
first line. Then, if your operating system provides the proper
support, rlab can execute your program, interactively, or in the
background by simply typing:
$ chmod +x program.r
$ ./program.r
Subsections